<template>
    <div class="divBox">
      <el-card class="box-card">
        <el-table
          v-loading="listLoading"
          :data="tableData.data"
          style="width: 100%"
          size="mini"
          class="table"
          highlight-current-row
        >
          <el-table-column
            prop="id"
            label="ID"
            width="80"
          />
          <el-table-column
            prop="adminId"
            label="管理员id"
            min-width="80"
          />
          <el-table-column
            label="管理员账号"
            min-width="100"
            prop="adminAccount"
          />
          <el-table-column
            prop="userName"
            label="操作状态"
            min-width="80"
          >
            <template slot-scope="scope">
                <el-tag :type="scope.row.status === 0 ? '' : 'danger'" size="mini">{{scope.row.status === 0 ? '正常' : '异常'}}</el-tag>
            </template>
        </el-table-column>
          <el-table-column
            prop="description"
            label="接口描述"
            min-width="150"
            show-overflow-tooltip
          />
          <el-table-column
            prop="createTime"
            label="操作时间"
            min-width="150"
          />
          <el-table-column
            prop="ip"
            label="主机地址"
            min-width="120"
          />
          <el-table-column
            prop="method"
            label="方法名称"
            min-width="150"
            show-overflow-tooltip
          />
          <el-table-column
            prop="url"
            label="请求URL"
            min-width="150"
            show-overflow-tooltip
          />
          <el-table-column
            prop="requestMethod"
            label="请求方式"
            min-width="80"
          />
          <el-table-column
            prop="methodType"
            label="请求类型"
            min-width="80"
          />
          <el-table-column
            prop="requestParam"
            label="请求参数"
            min-width="150"
          />
          <el-table-column
            prop="result"
            label="返回参数"
            min-width="150"
            show-overflow-tooltip
          >
         <template slot-scope="scope">
            <el-popover
                placement="bottom"
                width="500"
                trigger="click"
                :content="scope.row.result">
                <el-button type="text" slot="reference" size="mini">查看</el-button>
            </el-popover>
         </template>
         </el-table-column>
          
        </el-table>
        <div class="block">
          <el-pagination
            :page-sizes="[20, 40, 60, 80]"
            :page-size="tableFrom.limit"
            :current-page="tableFrom.page"
            layout="total, sizes, prev, pager, next, jumper"
            :total="tableData.total"
            @size-change="handleSizeChange"
            @current-change="pageChange"
          />
        </div>
      </el-card>
    </div>
  </template>
  
  <script>
    import { sensitiveListApi } from '@/api/systemadmin'
    export default {
      name: 'SensitiveLog',
      data() {
        return {
          tableData: {
            data: [],
            total: 0
          },
          listLoading: true,
          tableFrom: {
            page: 1,
            limit: 20
          }
        }
      },
      mounted() {
        this.getList()
      },
      methods: {
        // 列表
        getList(num) {
          this.listLoading = true
          this.tableFrom.page = num ? num : this.tableFrom.page;
          sensitiveListApi(this.tableFrom).then(res => {
            this.tableData.data = res.list
            this.tableData.total = res.total
            this.listLoading = false
          }).catch((res) => {
            this.listLoading = false
          })
        },
        pageChange(page) {
          this.tableFrom.page = page
          this.getList()
        },
        handleSizeChange(val) {
          this.tableFrom.limit = val
          this.getList()
        }
      }
    }
  </script>
  
  <style scoped lang="scss">
  </style>
  